cmake_minimum_required(VERSION 3.13)
project(icon_dialog C)

set(CMAKE_C_STANDARD 99)


find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)

message(STATUS "GTK3_INCLUDE_DIRS:${GTK3_INCLUDE_DIRS}")
message(STATUS "GTK3_LIBRARIES:${GTK3_LIBRARIES}")

include_directories(gtk)


aux_source_directory(src SRCS)
aux_source_directory(gtk UI)

add_executable(icon_dialog ${SRCS} ${UI})

set(CMAKE_SKIP_RPATH true)


target_link_libraries(${PROJECT_NAME}
        PUBLIC ${GTK3_LIBRARIES})
target_include_directories(${PROJECT_NAME}
        PUBLIC ${GTK3_INCLUDE_DIRS})

set_target_properties(${PROJECT_NAME} PROPERTIES
        LINK_FLAGS_RELEASE "-Wl,-rpath,'$ORIGIN' -s"
)

if( DEFINED ENV{SUNSCAN_ROOT} )
    message(STATUS "Defined SUNSCAN_ROOT:$ENV{SUNSCAN_ROOT}")
    set(EXECUTABLE_OUTPUT_PATH $ENV{SUNSCAN_ROOT}/bin)
else()
    message(STATUS "Not defined SUNSCAN_ROOT")
    set(EXECUTABLE_OUTPUT_PATH  $ENV{HOME}/SunScan/bin)
endif()
